<div id="content">
	<%@ include file="../common/hello.jsp"%>
	<script type="text/javascript">
		function validateFormChangePassword() {
			invalidid = true;
			var oldPass = document.frmChangePassword.userOldPass.value;
			errOldPass = document.getElementById("errorOldPass");
			errOldPass.innerHTML = "";
			if (oldPass == "") {
				errOldPass.innerHTML = "Don't know current password";
				invalidid = false;
			} else if (oldPass.length < 6) {
				errOldPass.innerHTML = "Password must be  least 6 letters";
				invalidid = false;
			}
			var newPass = document.frmChangePassword.userNewPass.value;
			errNewPass = document.getElementById("errorNewPass");
			errNewPass.innerHTML = "";
			if (newPass == "") {
				errNewPass.innerHTML = "New password is not empty!";
				invalidid = false;
			} else {
				if (newPass.length < 6) {
					errNewPass.innerHTML = "New password must be  least 6 letters.";
					invalidid = false;
				} else {
					if (!checkpassword(newPass)) {
						errNewPass.innerHTML = "New Password must have letters and numbers";
						invalidid = false;
					}
				}
			}
			var confirmPass = document.frmChangePassword.userConfirmPass.value;
			errConfirmPass = document.getElementById("errorConfirmPass");
			errConfirmPass.innerHTML = "";
			if (confirmPass == "") {
				errConfirmPass.innerHTML = "Confirm password is not empty!";
				invalidid = false;
			} else {
				if (confirmPass.length < 6) {
					errConfirmPass.innerHTML = "Confirm passwordmust be  least 6 letters. ";
					invalidid = false;
				} else {
					if (checkpassword(newPass) != checkpassword(confirmPass)) {
						errConfirmPass.innerHTML = "Confirm password must same new password.";
						invalidid = false;
					}
				}
			}
			return invalidid;

		};
		function checkpassword(str) {
			var c = /^(?=.*\d)(?=.*[a-z])\w{6,}$/;
			return c.test(str);
		};
	</script>
	<form name="frmChangePassword" action="change_password1" method="post"
		onsubmit="return validateFormChangePassword();">
		<table width="400px" align="left" border="">
<p><font color = "red"><h1>Change password!</h1></font></p>
			<tr>
				<td align="right" width="150px"><label>Current
						password:</label></td>
				<td align="left"><input class="txtBox" type="password"
					name="userOldPass" /></td>
			</tr>
			<tr>
				<td></td>
				<td>
					<div class="error" id="errorOldPass"></div>
				</td>
			</tr>
			<tr>
				<td align="right" width="150px"><label>New password:</label></td>
				<td align="left"><input class="txtBox" type="password"
					name="userNewPass" /></td>
			</tr>
			<tr>
				<td></td>
				<td>
					<div class="error" id="errorNewPass"></div>
				</td>
			</tr>
			<tr>
				<td align="right" width="150px"><label>Confirm
						Password:</label></td>
				<td align="left"><input class="txtBox" type="password"
					name="userConfirmPass" /></td>
			</tr>
			<tr>
				<td></td>
				<td>
					<div class="error" id="errorConfirmPass">${message}</div>
				</td>
			</tr>
			<tr align="right">
				<td colspan="2"><input name="submit" type="submit"
					class="btton" value="Change password" /></td>


			</tr>

		</table>

	</form>

</div>
